<%= header %>
<%= boomerangScript %>
<base href="/pages/05-angular/" />
<script src="../../vendor/angular/angular.js"></script>
<script src="../../vendor/angular-resource/angular-resource.js"></script>
<script src="../../vendor/angular-route/angular-route.js"></script>
<script>
window.angular_imgs = [3000];

window.angular_html5_mode = false;

// view a widget then come back so debugging (F5) is easier
window.angular_nav_routes = ["/widgets/1", "/"];
</script>
<script src="support/app.js"></script>
<div ng-app="app">
	<div ng-view>
	</div>
</div>
<script src="112-autoxhr-open-without-send.js" type="text/javascript"></script>
<script>
var img, xhr, beaconCount = 0;
BOOMR.subscribe("beacon", function(vars) {
	beaconCount++;
	if (beaconCount === 3) {
		setTimeout(function() {
			xhr = new XMLHttpRequest();
			xhr.open("GET", "/delay?delay=100&file=/pages/05-angular/support/widgets.json&rnd=" + Math.random());
			xhr.addEventListener("load", function() {
				img = document.createElement("img");
				img.src = "/delay?delay=1000&id=xhr&file=/pages/05-angular/support/img.jpg";
				document.body.appendChild(img);
				xhr2 = new XMLHttpRequest();
				xhr2.open("GET", "/delay?delay=100&file=/pages/05-angular/support/widgets.json&rnd=" + Math.random());
				// Don't call send on xhr
			});
			xhr.send(null);
		}, 100);
	}
});
BOOMR_test.init({
	testAfterOnBeacon: 4,
	Angular: {
		enabled: true
	},
	instrument_xhr: true,
	autorun: false
});

// Timeout after 30s in case auto xhr is still waiting for a resource
window.timerid = setTimeout(function() {
	BOOMR_test.runTests();
}, 30000);

</script>
<%= footer %>
